﻿//=====================================================================================================
// LocalizationLibrary
// The Localization Library is a collection of reusable software components that provide 
// support for localization. This library enables you to localize WPF, Silverlight and WP7 applications.
// (http://localizationlibrary.codeplex.com)
//=====================================================================================================
// Author: Nicola Gallo (Website: www.nicola.gallo.name, Email: nicolagmt@hotmail.it) 
//=====================================================================================================

namespace LocalizationLibrary.Tests.Infrastructure
{
    //.NET References
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;

    /// <summary>
    /// Represents a mock <see cref="LocalizationProvider"/> which raise an exception during the localization.
    /// </summary>
    public class LocalizationProviderWithExceptionMock : LocalizationProvider
    {
        //Constructors

        /// <summary>
        /// Creates a new instance of <see cref="LocalizationProviderWithExceptionMock"/> class.
        /// </summary>
        /// <param name="token">Token to localize.</param>
        /// <param name="onLocalization">Callback to call when the <see cref="LocalizationProvider"/> has completed the localization.</param>
        /// <exception cref="ArgumentNullException">
        /// Thrown whether <paramref name="token"/> parameter is null.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        /// Thrown whether <paramref name="onLocalization"/> parameter is null.
        /// </exception>
        public LocalizationProviderWithExceptionMock(DynamicResourceToken token,
            LocalizationCompletionCallback onLocalization)
            : base(token, onLocalization) { }

        //Methods

        /// <summary>
        /// Localize the input <paramref name="dynamicResourceToken"/> for the input <paramref name="language"/>.
        /// </summary>
        public override void Localize()
        {
            System.Threading.Thread.Sleep(2000);
            throw new Exception();
        }
    }
}
